import datetime
import random

class SplitProcessUtil:
    def __init__(self):
        pass

    def updateLockId(self,db):
        # 生成当前锁id
        curdate = datetime.datetime.now().strftime("%H%M%S")
        seed = random.randint(100, 999)
        lockid = str(curdate) + str(seed)
        # print(lockid)
        #先更新锁id
        info = {"lockid": lockid}
        db.update(info, "exec_status=0 and lockid < 1 limit 5")
        #再重新获取锁id的相关纪录
        return db.selectAll("exec_status=0 and lockid=" + lockid, "*", True)

